package com.helen.adapter;
import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.helen.entity.PersonPageItem;
import com.helen.shopping.R;
import com.helen.utils.MyLog;

import java.util.List;


/**
 * Created by yang on 2017/11/23.
 */

public class PersonPageAdapter extends BaseQuickAdapter<PersonPageItem, BaseViewHolder> {
    private int redColor = Color.parseColor("#ff0000");
    public PersonPageAdapter(int layoutResId, List<PersonPageItem> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PersonPageItem item) {
        MyLog.d("yang","getName=="+item.getName());
        helper.setImageResource(R.id.iv_img,item.getIconId());
        helper.setText(R.id.tv_name, item.getName());
        if(helper.getAdapterPosition()==0){
            helper.setTextColor(R.id.tv_name,redColor);
        }

        if(helper.getAdapterPosition()==8){
            helper.setTextColor(R.id.tv_name,redColor);
        }
//        helper.setText(R.id.tv_content,item.getContent());
//        TextView tvContent = helper.getView(R.id.tv_content);
//        tvContent.setText(item.getContent());
//        Drawable arrow_r = null;
//        if(item.isHasArrow()) {
//            arrow_r = ContextCompat.getDrawable(mContext, R.mipmap.icon_right);
//            arrow_r.setBounds(0, 0, arrow_r.getMinimumWidth(), arrow_r.getMinimumHeight());  //此为必须写的
//        } else {
//            LinearLayout ll_root = helper.getView(R.id.root);
//            ll_root.setClickable(false);
//        }
//        tvContent.setCompoundDrawables(null, null, arrow_r, null);
    }
}
